using AntBlazorTableSample.Api.Models;
using Scalar.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers(c =>
{
    c.SuppressAsyncSuffixInActionNames = false;
});

// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();

builder.Services.AddRouting(options =>
{
    options.LowercaseQueryStrings = true;
    options.LowercaseUrls = true;
});

builder.Services.AddCors(o =>
{
    o.AddPolicy("cors", b =>
    {
        b.AllowAnyOrigin();
    });
});


builder.Services.AddSingleton<CustomerStore>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
    app.MapScalarApiReference(config =>
    {
        config.Title = "Customers Public APIs";
    });

}

app.UseCors("cors");

app.UseAuthorization();

app.MapControllers();

app.Run();
